const fs = require('fs');
const path = require('path');

module.exports = function(app) {
    const modulesDir = path.join(__dirname, './');

    fs.readdirSync(modulesDir).forEach(file => {
        if (file.endsWith('.js') && file !== 'index.js') {
            console.log('load module:', file, 'app');
            require(path.join(modulesDir, file))(app);
        }
    });
};